package com.qilu.careprogram.service.impl;

import com.qilu.careprogram.dao.MedicineDao;
import com.qilu.careprogram.pojo.MedicineInfo;
import com.qilu.careprogram.service.MedicineService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
@Service
public class MedicineServiceImpl implements MedicineService {
    @Resource
    MedicineDao medicineDao;

    @Override
    public List<MedicineInfo> getMedicineInfo(String hospitalNumber, Integer page, Integer pageSize) {
        return medicineDao.selectMedicationRecordsByHospitalNumber
                (hospitalNumber, page * pageSize, pageSize);

    }

    @Override
    public void addMedicineInfo(MedicineInfo medicineInfo) {
        medicineDao.addMedicineInfo(medicineInfo);
    }

    @Override
    public void updateMedicineInfo(MedicineInfo medicineInfo) {
        medicineDao.updateMedicineInfo(medicineInfo);
    }

    @Override
    public void deleteMedicineInfo(MedicineInfo medicineInfo) {
        medicineDao.deleteMedicineInfo(medicineInfo);
    }
}
